<%@page import="cn.easybuy.entity.Product_category"%>
<%@page import="cn.easybuy.utils.CategoryPage"%>
<%@page import="cn.easybuy.entity.News"%>
<%@include file="../common/CheckLoginBackend.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>二组牛逼</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../statics/css/style.css" />
<script type="text/javascript" src="../statics/js/jquery.js"></script>
<script type="text/javascript">
	var contextPath = "${ctx}";
	function fan(pageNo) {
		window.location.href = "CategoryListServlet?action=pageShow&pageNo=" + pageNo;
	}
	function del(id) {
		var f = window.confirm("确定删除吗？");
		if (f) {
			window.location.href = "CategoryListServlet?action=del&id=" + id;
		}
	}
</script>
</head>
<body>
	<%@include file="../common/Admin_Header.jsp"%>
	<div class="i_bg bg_color">
		<!--Begin 用户中心 Begin -->
		<div class="m_content">
			<%@include file="../common/Admin_left.jsp"%>
			<div class="m_right" id="content">
				<div class="mem_tit">用户列表</div>
				<div class="mem_tit">
					<a href="Member_AddCategory.jsp">添加分类</a>
				</div>
				<br />
				<table border="0" class="order_tab"
					style="width:930px; text-align:center; margin-bottom:30px;"
					cellspacing="0" cellpadding="0">
					<tbody>
						<tr>
							<td width="20%">分类名称</td>
							<td width="20%">分类级别</td>
							<td width="20%">父级分类</td>
							<td width="20%" colspan="2">操作</td>

						</tr>
						<!-- 循环page对象中的list属性 list属性是一个List<Catagory>集合 -->
						<c:forEach items="${requestScope.page.list}" var="pc"
							varStatus="v">
							<tr>
								<!-- 遍历list.name 获取分类名称 -->
								<td>${pc.name}</td>
								<!-- 遍历list.type判断分类级别 -->
								<td><c:if test="${pc.type==1}">一级分类</c:if> <c:if
										test="${pc.type==2}">二级分类</c:if> <c:if test="${pc.type==3}">三级分类</c:if>
								</td>
								<td>
									<!-- 遍历list.parseID判断父分类是否存在  如果父分类是0  则代表为1级分类  父ID不存在 --> <c:if
										test="${pc.parentId==0}">无</c:if> <!-- 如果父分类ID不为0 则进行循环 使用当前的分类的父ID和全部分类里面一/二级分类的所有ID进行比对，存在则显示父分类 -->
									<c:if test="${pc.parentId!=0}">
										<c:forEach items="${CatagoryList.get(0)}" var="pc1">
											<c:if test="${pc1.id==pc.parentId}">${pc1.name}</c:if>
										</c:forEach>
										<c:forEach items="${CatagoryList.get(1)}" var="pc2">
											<c:if test="${pc2.id==pc.parentId}">${pc2.name}</c:if>
										</c:forEach>
									</c:if></td>
								<td><a href="CategoryListServlet?action=update&id=${pc.id}">修改</a>
								</td>
								<td><a href="javascript:del(${pc.id})">删除</a>
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<%@include file="../common/Page.jsp"%>
			</div>
		</div>
	</div>
	<%@include file="../common/footer.jsp"%>
</body>
</html>


